
typedef unsigned char EES_SideType;      ///< 买卖方向
#define EES_SideType_open_long 1         ///< =买单（开今）
#define EES_SideType_close_today_long 2  ///< =卖单（平今）
#define EES_SideType_close_today_short 3 ///< =买单（平今）
#define EES_SideType_open_short 4        ///< =卖单（开今）
#define EES_SideType_close_ovn_short 5   ///< =买单（平昨）
#define EES_SideType_close_ovn_long 6    ///< =卖单（平昨）
#define EES_SideType_opt_exec 11         ///< =期权行权
#define EES_SideType_close_short 21      ///< =买单（平仓）
#define EES_SideType_close_long 22       ///< =卖单（平仓）

typedef enum OffsetType
{
    OPEN = '0',     //����
    CLOSE,          //ƽ��,����Ϊƽ��
    FORCECLOSE,     //ǿƽ
    CLOSETODAY,     //ƽ��
    CLOSEYESTERDAY, //ƽ��
} OffsetType;

EES_SideType side_convert(bool buy, OffsetType offset)
{

    if (buy)
    {
        if (OffsetType::OPEN == offset)
        {
            return EES_SideType_open_long;
        }
        if (OffsetType::CLOSETODAY == offset)
        {
            return EES_SideType_close_today_long;
        }
        if (OffsetType::CLOSEYESTERDAY == offset)
        {
            return EES_SideType_close_ovn_long;
        }
        if (OffsetType::CLOSE == offset)
            ; ///  this situation shoud do what?
    }
    else
    {
        if (OffsetType::OPEN == offset)
        {
            return EES_SideType_open_short;
        }
        if (OffsetType::CLOSETODAY == offset)
        {
            return EES_SideType_close_today_short;
        }
        if (OffsetType::CLOSEYESTERDAY == offset)
        {
            return EES_SideType_close_ovn_short;
        }
    }
}